package com.inspector.app.ui.task;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.FragmentManager;

import com.inspector.app.ui.chat.HistoryTaskChatActivity;
import com.inspector.app.ui.chat.TaskChatActivity;
import com.inspector.app.ui.vo.TaskClickType;
import com.inspector.app.ui.vo.TaskItem;

public class TaskFragmentClickUtils {

    public static void setClickType(TaskClickType clickType, TaskItem item, Context context, FragmentManager fragmentManager, TaskExecutionDialog.TaskExecutionListener taskExecutionListener) {
        switch (clickType) {
            case PASSWORD_TYPE:
            case APPLY_TYPE:
                new TaskExecutionDialog().newInstance().setType(clickType).setData(item).setOnTaskExecutionListener(taskExecutionListener).showDialog(fragmentManager);
                break;
            case JOIN_TYPE:
                Intent chatIntent = new Intent(context, TaskChatActivity.class);//加入聊天页面
                Bundle chatBundle = new Bundle();
                chatBundle.putParcelable("TaskItem", item);
                chatIntent.putExtras(chatBundle);
                context.startActivity(chatIntent);
                break;
            case RECORD_TYPE:
                Intent intent = new Intent(context, HistoryTaskChatActivity.class);//查看历史记录
                Bundle bundle = new Bundle();
                bundle.putParcelable("TaskItem", item);
                intent.putExtras(bundle);
                context.startActivity(intent);
                break;
            case CHECK_TYPE:

                break;
        }


    }

}
